from pytz import timezone
import datetime
from config import config


def is_trading_time():
    ny_tz = timezone('America/New_York')
    now = datetime.datetime.now(ny_tz).time()

    start = config.trading_hours['start']
    end = config.trading_hours['end']

    return start <= now <= end and \
        not (now < datetime.time(9, 45)) and \
        not (now > datetime.time(15, 55))